<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%><%@taglib
	uri="http://java.sun.com/jsp/jstl/core" prefix="c"%><%@ page
	language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<!DOCTYPE html >
	<!--  Website template by freewebsitetemplates.com  -->
<html>

<head>
<title>Minimalistic Web Template</title>
<meta charset="iso-8859-1" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
		<link href="css/ie6.css" rel="stylesheet" type="text/css" />
	<![endif]-->
<!--[if IE 7]>
        <link href="css/ie7.css" rel="stylesheet" type="text/css" />  
	<![endif]-->

</head>

<body>
	<div id="background">
		<div id="page">

			<div class="header">
				<div class="footer">
					<div class="body">

						<!-- include Menu -->
						<jsp:include page="Menu.jsp" flush="True">
							<jsp:param name="page_call" value="ShareWithMe" />
						</jsp:include>

						<sql:query dataSource="jdbc/sharewithme" var="rs">
							select btypeid, btypename from sharewithme.tbbooktype where btypeid = ${param.btypeid }
						</sql:query>
						<h2>
							ห้อง
							<c:forEach items="${rs.rows }" var="type">${type.btypename }</c:forEach>
						</h2>
						<sql:query dataSource="jdbc/sharewithme" var="rs">
						
						select bisbn, bnamethai, bnameeng, bwriter, bpublishing, 
										bedition,btranslate, bprice 
										FROM  sharewithme.tbbooks
										where btypeid = ${param.btypeid }
										order by bnamethai
										limit ${param.stepShow*10}, 10
 </sql:query>

						<table border="1" width="50%"  bgcolor="grey" align="center">
							<c:forEach items="${rs.rows }" var="book">
								<tr>
									<th><img src="/ShareWithMe/BookCoverImage?isbn=${book.BISBN }" alt="ภาพปก" width="100px" height="100px"/></th><th><a href="ShareWithMe_detail.jsp?bisbn=${book.bisbn }">${book.bnamethai}</a>
										by ${book.bwriter }<br></th>
								</tr>
							</c:forEach>
						</table>
						<%--calculate for stepshow --%>
						<sql:query var="rs" dataSource="jdbc/sharewithme">
						
						select count(*)/10 as end FROM  sharewithme.tbbooks
										where btypeid = ${param.btypeid }
										
										</sql:query>
						<c:forEach items="${rs.rows }" var="fe">
						click to select page<c:forEach begin="0" end="${fe.end }" step="1"
								var="step">
								| <a
									href="<%= request.getContextPath() %>/BookTypeDetail.jsp?btypeid=${param.btypeid }&stepShow=${step}">${step+1}</a> | </c:forEach>
						</c:forEach>
					</div>
				</div>

				<div class="shadow">&nbsp;</div>
			</div>
		</div>
	</div>
</body>
</html>


